<template>
    <Header></Header>
  <div>
    <el-table :data="userData" stripe style="width: 100%">
      <el-table-column label="注册日期">
        <!-- <template slot-scope="scope"> -->
          <!-- <span style="margin-left: 10px">{{
            scope.row.registerTime | fmtDate
          }}</span> -->
        <!-- </template> -->
      </el-table-column>
      <el-table-column prop="realname" label="姓名" width="180">
      </el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
    </el-table>
  </div>
</template>

<script>
// 交互逻辑
import axios from "axios";
import Header from './components/header.vue'
export default {
    components:{Header},
  data() {
    return {
      userData: [],
    };
  },
  methods: {
    async usering() {
      axios({
        url: "http://127.0.0.1:8888/baseUser/findAll",
        method: "get",
        headers: {
          Authorization: sessionStorage.getItem("token"),
        },
      })
        .then((res) => {
          console.log(res.data.data);

          this.userData = res.data.data;
        })
        .catch((error) => {
          console.log(error);
          this.$message.error("获取数据失败");
        });
    },
  },
  created() {
    this.usering();
  },
  filters: {
    fmtDate(val) {
      return new Date(val).toLocaleString();
    },
  },
};
</script>
